<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------
namespace addon\mall\logic;
use app\common\logic\LogicBase;
use \tpfcore\Core;

class ShopConfig extends LogicBase
{
	public function getShopConfig($data=[]){
		return Core::loadAddonModel("Setting")->getOneObject($data);
	}
	public function saveShopConfig($data=[]){
		$validate=Core::addonValidate($this->name);
        $validate_result = $validate->scene("save")->check($data['options']);
        if (!$validate_result) {
            return [RESULT_ERROR, $validate->getError(), null];
        }

        $result = Core::loadAddonModel("Setting")->saveObject($data);

        if($result){
        	return [RESULT_SUCCESS,"操作成功",url("mall/ShopConfig/index")];
        }
        
		return [RESULT_ERROR,"操作失败"];
	}
}